﻿using System;
using AcademicPlanner.Data;

namespace AcademicPlanner.Domain
{
	/// <summary>
	/// Operation is the base class for more granular/atomic <c>Task</c>s that
	/// usually involve some access control protection.
	/// </summary>
	/// <version>1.0</version>
	/// <since>1.0</since>
	abstract class Operation : Task
    {
		/// <summary>
		/// Launches this Operation. This method is basically an alias for
		/// <see cref="M:Task.Run"/>
		/// </summary>
		/// <version>1.0</version>
		/// <since>1.0</since>
		public void Launch()
		{
			base.Run();
		}

		/// <summary>
		/// Performs this Operation's bulk work. This method basically relies on
		/// <see cref="M:Execute"/>.
		/// </summary>
		/// <version>1.0</version>
		/// <since>1.0</since>
		protected override void Perform()
		{
			Execute();
		}

		/// <summary>
		/// Executes this Operation's bulk work. This method is abstract.
		/// </summary>
		/// <version>1.0</version>
		/// <since>1.0</since>
		protected abstract void Execute();
    }
}
